{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 第四题：支持向量机的回归任务\n",
    "\n",
    "实验内容：\n",
    "1. 使用支持向量机完成鲍鱼年龄预测问题\n",
    "2. 使用训练集训练模型，计算测试集的MAE和RMSE和MSE"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. 读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "data = np.loadtxt('data/Abalone.csv', delimiter = \",\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.数据集划分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((2923, 8), (2923,), (1254, 8), (1254,))"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 数据集分割\n",
    "from sklearn.model_selection import train_test_split\n",
    "trainX, testX, trainY, testY = train_test_split(data[:,0:-1], data[:,-1], test_size = 0.3, random_state = 32)\n",
    "trainX.shape, trainY.shape, testX.shape, testY.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.导入模型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 引入模型\n",
    "from sklearn.svm import SVR\n",
    "from sklearn.svm import LinearSVR\n",
    "from sklearn.metrics import mean_absolute_error\n",
    "from sklearn.metrics import mean_squared_error"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rbf：C=0.1\n",
      "mae: 1.75\n",
      "rmse 2.69\n"
     ]
    }
   ],
   "source": [
    "# YOUR CODE HERE\n",
    "regr=SVR(kernel='rbf',C=0.1)\n",
    "regr.fit(trainX,trainY)\n",
    "prediction=regr.predict(testX)\n",
    "MAE=round(mean_absolute_error(testY,prediction),2)\n",
    "RMSE=round(mean_squared_error(testY,prediction)** 0.5,2)\n",
    "print('rbf：C=0.1')\n",
    "print('mae:',MAE)\n",
    "print('rmse',RMSE)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rbf：C=1\n",
      "mae: 1.58\n",
      "rmse 2.38\n"
     ]
    }
   ],
   "source": [
    "regr=SVR(kernel='rbf',C=1)\n",
    "regr.fit(trainX,trainY)\n",
    "prediction=regr.predict(testX)\n",
    "MAE=round(mean_absolute_error(testY,prediction),2)\n",
    "RMSE=round(mean_squared_error(testY,prediction)** 0.5,2)\n",
    "print('rbf：C=1')\n",
    "print('mae:',MAE)\n",
    "print('rmse',RMSE)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "linear：C=0.1\n",
      "mae: 1.75\n",
      "rmse 2.66\n"
     ]
    }
   ],
   "source": [
    "regr=LinearSVR(C=0.1)\n",
    "regr.fit(trainX,trainY)\n",
    "prediction=regr.predict(testX)\n",
    "MAE=round(mean_absolute_error(testY,prediction),2)\n",
    "RMSE=round(mean_squared_error(testY,prediction)** 0.5,2)\n",
    "print('linear：C=0.1')\n",
    "print('mae:',MAE)\n",
    "print('rmse',RMSE)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "linear：C=1\n",
      "mae: 1.61\n",
      "rmse 2.4\n"
     ]
    }
   ],
   "source": [
    "regr=LinearSVR(C=1)\n",
    "regr.fit(trainX,trainY)\n",
    "prediction=regr.predict(testX)\n",
    "MAE=round(mean_absolute_error(testY,prediction),2)\n",
    "RMSE=round(mean_squared_error(testY,prediction)** 0.5,2)\n",
    "print('linear：C=1')\n",
    "print('mae:',MAE)\n",
    "print('rmse',RMSE)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sigmoid：C=0.1\n",
      "mae: 67.45\n",
      "rmse 94.28\n"
     ]
    }
   ],
   "source": [
    "regr=SVR(kernel='sigmoid')\n",
    "regr.fit(trainX,trainY)\n",
    "prediction=regr.predict(testX)\n",
    "MAE=round(mean_absolute_error(testY,prediction),2)\n",
    "RMSE=round(mean_squared_error(testY,prediction)** 0.5,2)\n",
    "print('sigmoid：C=0.1')\n",
    "print('mae:',MAE)\n",
    "print('rmse',RMSE)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sigmoid：C=1\n",
      "mae: 67.45\n",
      "rmse 94.28\n"
     ]
    }
   ],
   "source": [
    "regr=SVR(kernel='sigmoid')\n",
    "regr.fit(trainX,trainY)\n",
    "prediction=regr.predict(testX)\n",
    "MAE=round(mean_absolute_error(testY,prediction),2)\n",
    "RMSE=round(mean_squared_error(testY,prediction)** 0.5,2)\n",
    "print('sigmoid：C=1')\n",
    "print('mae:',MAE)\n",
    "print('rmse',RMSE)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 请你使用SVR，完成鲍鱼年龄预测问题\n",
    "\n",
    "\n",
    "核函数 | C | MAE | RMSE\n",
    "- | - | - | - \n",
    "rbf | 0.1 | 1.75 | 2.69\n",
    "rbf | 1 | 1.58 | 2.38\n",
    "linear | 0.1 | 1.75 | 2.66\n",
    "linear | 1 | 1.61 | 2.4\n",
    "sigmoid | 0.1 | 67.45 | 94.28\n",
    "sigmoid | 1 | 67.45 | 94.28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0, 0.5, 'MAE')"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEWCAYAAABxMXBSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deXwV5b3H8c8vC4EQ9iyyryGIC4ggoiDgvtTdtu57rdttvddabe+93Xur1rbWat0Rl4rVqsW6Yq0sgqgBEdnDTliSALKvSX73j5nQQ0xIAjmZLN/363Ve55xnnpn5nSGc33meZ+YZc3dERESqKyHqAEREpGFR4hARkRpR4hARkRpR4hARkRpR4hARkRpR4hARkRpR4hCJYWY/M7MXanmbo8wsvza32RiY2QgzW3iA5T3MzM0s6RD2sdzMTj3Y9aViShwNnJkNN7NpZrbZzDaa2VQzG2Jmw8xsu5m1qmCdz83s9pj/mDPLLU83sz1mtjymbLmZ9ahhbNeG2/99ufILwvKxNdlebTKzsWZWbGadooqhIoeaZML1S81sW7nHsNqMsza4+xR3zyl7f6hf8uG/6a9qJ7oKt29m9j0zmxP+38o3s1fM7Kh47bO+UuJowMysNfAm8CegPdAZ+Dmw290/BvKBi8utcyTQHxgXU9wyLC9zObCslsJcAny73K/Gq4FFtbT9GjOzlgTHZTNwRVRxxNEad08r9/i4fKXwizChXFmNft0fSmugAfoj8H3gewT/3/oCfwfOiTKoKChxNGx9Adx9nLuXuPtOd5/g7rPD5c8SfEnHuhp4y903xJQ9D1xTrs5zle3UzM42s3lmttXMVpvZDw4Q4zrgS+CMcN32wAnAG+W2eXzYctpkZl+Y2aiYZdeZ2fxwf0vN7Lsxy0aFv/zuNLNCM1trZtcdIB4IksYm4BflPneZ5mb213B/M81sQMz+7g4/81YzW2hmp4TlKWb2oJmtCR8PmllKRTsPW1t9Yt6PNbNfh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a1a0kYlUjy4AFKl7o4G9sRcxuvusCOMRqRG1OETq3pHAjKiDEDlYShwiIlIjShwidW8uwfTnIg2SEodI3fsXkGJm3ykrCO+bPjLCmESqTZMcikTAzDoR3IjqWGAXsBy4w93zooxLpDqUOEREpEbUVSUiIjWixCEiIjWixCEiIjWixCEiIjWixCEiIjWixCEiIjWixCEiIjXy/4dx9/Am5TzFAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "# YOUR CODE HERE\n",
    "y = []\n",
    "\n",
    "for i in range(10):\n",
    "    m = 0.1 * (i + 1)\n",
    "    clf=SVR(kernel='rbf',C=m)\n",
    "    clf.fit(trainX,trainY)\n",
    "    prediction=clf.predict(testX)\n",
    "    y.append(prediction)\n",
    "    \n",
    "x = np.linspace(0.1,1,10)\n",
    "test = [mean_absolute_error(testY, val) for val in y]\n",
    "\n",
    "plt.figure()\n",
    "plt.plot(x,test,'-')\n",
    "plt.title(\"SVM's Mean Absolute Error with the C\")\n",
    "plt.xlabel(\"C\")    \n",
    "plt.ylabel(\"MAE\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
